package cConfig

type ConfigCenterDriver string

const (
	ConfigCenterConfigName = "ConfigCenterConf"

	FileDriver      ConfigCenterDriver = "file"
	ZipDriver       ConfigCenterDriver = "zip"
	NacosDriver     ConfigCenterDriver = "nacos"
	CustomizeDriver ConfigCenterDriver = "customize"
)

type ConfigCenterConf struct {
	Enable   bool                          `json:"enable"`
	Backup   bool                          `json:"backup"`
	Driver   ConfigCenterDriver            `json:"driver"`
	Interval int64                         `json:"interval"`
	Layers   int64                         `json:"layers"`
	Clients  ConfigCenterConf_Clients      `json:"clients"`
	Listens  []ConfigCenterConf_ListenItem `json:"listens"`
}

type ConfigCenterConf_Clients struct {
	File      FileClient      `json:"file"`
	Zip       ZipClient       `json:"zip"`
	Nacos     NacosClient     `json:"nacos"`
	Customize ClientInterface `json:"-"`
}

type ConfigCenterConf_ListenItem struct {
	Group  string             `json:"group"`
	Data   string             `json:"data"`
	Conf   string             `json:"conf"`
	Driver ConfigCenterDriver `json:"driver"`
}

func (i *ConfigCenterConf) ConfigName() string {
	return ConfigCenterConfigName
}

var config_center_config *ConfigCenterConf
